FSEEK

Section: Standard I/O Functions (3S)
Updated: December 5, 1987
Index Return to Main Contents
 

NAME

fseek, ftell, rewind - reposition a stream  

SYNOPSIS

#include <stdio.h>

fseek(stream, offset, ptrname)
FILE *stream;
long offset;

long ftell(stream)
FILE *stream;

rewind(stream)  

DESCRIPTION

Fseek sets the position of the next input or output operation on the stream. The new position is at the signed distance offset bytes from the beginning, the current position, or the end of the file, according as ptrname has the value 0, 1, or 2.

Fseek undoes any effects of ungetc(3S).

Ftell returns the current value of the offset relative to the beginning of the file associated with the named stream. It is measured in bytes on UNIX; on some other systems it is a magic cookie, and the only foolproof way to obtain an offset for fseek.

Rewind(stream) is equivalent to fseek(stream, 0L, L_SET).  

SEE ALSO

lseek(2), fopen(3S)  

DIAGNOSTICS

Fseek returns -1 for improper seeks, otherwise zero.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
DIAGNOSTICS

This document was created by man2html, using the manual pages.
Time: 04:51:46 GMT, January 31, 2023